package com.itcast.spring6.aop.annotation;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * @author zhangtian105
 * @date 2023/5/11
 * @apiNote
 */
@EnableAspectJAutoProxy(exposeProxy = true)
@ComponentScans(value = {@ComponentScan(basePackages = "com.itcast.spring6.aop.annotation")})
public class AnnotationApplicationTest {
    public static void main(String[] args) {
        // 创建容器
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext() ;
        applicationContext.register(AnnotationApplicationTest.class);

        // 启动应用上下文
        applicationContext.refresh();

        HelloWorldService helloWorldService = applicationContext.getBean(HelloWorldService.class) ;
        helloWorldService.testThis("你说啥") ;

        // 关闭spring应用上下文
        applicationContext.close();
    }
}
